﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace SEBanking
{
    public partial class MasterPage : System.Web.UI.MasterPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["UserName"].ToString() == String.Empty)
            {
                Session["UserID"] = String.Empty;
                Session["UserName"] = String.Empty;
                Session["UserTypeID"] = -1;
                pnMenu.Visible = false;
                pnLogin.Visible = false;
            }
            else
            {
                pnMenu.Visible = true;
                pnLogin.Visible = true;
                lblName.Text = Session["UserName"].ToString();
            }

            if (Session["UserName"].ToString() == "Admin")
            {
                pnMenu.Visible = false;
                pnLogin.Visible = true;
                lblName.Text = Session["UserName"].ToString();
            }
        }

        protected void btnLogout_Click(object sender, EventArgs e)
        {
            if (Session["UserName"].ToString() != String.Empty)
            {
                Session["UserID"] = String.Empty;
                Session["UserName"] = String.Empty;
                Session["UserTypeID"] = -1;
                Response.Redirect("~/Index.aspx");
            }
        }
    }
}
